import 'package:flutter/cupertino.dart';

import '../../repository/api.dart';
import '../../repository/datas/knowledge_list_data.dart';

class KnowledgeViewModel with ChangeNotifier {
  List<KnowledgeListData?> list = [];

  Future knowledgeList() async {
    list = await Api.instance.knowledgeList();
    notifyListeners();
  }

  String generalSubTitle(List<KnowledgeChildren>? children) {
    if (children == null || children.isEmpty == true) {
      return "";
    }

    StringBuffer stringBuffer = StringBuffer();
    for (var element in children) {
      stringBuffer.write("${element.name} ");
    }

    return stringBuffer.toString();
  }
}
